package com.ruoyi.quality.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.quality.domain.dto.InspectionIqcDto;
import com.ruoyi.quality.service.InspectionIqcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.text.ParseException;

@RestController
@RequestMapping("/inspectionIqc")
public class InspectionIqcController {
    @Autowired
    InspectionIqcService inspectionIqcService;


    @PostMapping("/getInspectionIqcByPage")
    public R export(@RequestBody InspectionIqcDto materialDto)
    {
        return R.ok(inspectionIqcService.getInspectionIqcByPage(materialDto));
    }

    @PostMapping("/addInspectionIqc")
    public R addTest(@RequestBody InspectionIqcDto materialDto) throws ParseException {
        inspectionIqcService.addInspectionIqc(materialDto);
        return R.ok("添加成功");
    }

    @PostMapping("/delInspectionIqc")
    public R delTest(@RequestBody InspectionIqcDto materialDto){
        inspectionIqcService.delInspectionIqc(materialDto);
        return R.ok("删除成功");
    }

    @PostMapping("/updateInspectionIqc")
    public R updateTest(@RequestBody InspectionIqcDto materialDto){
        inspectionIqcService.updateInspectionIqc(materialDto);
        return R.ok("锁定成功");
    }



    @PostMapping("/uploadInspectionIqc")
    public R uploadMaterial(@RequestParam MultipartFile file) throws IOException {
        inspectionIqcService.uploadInspectionIqc(file);
        return R.ok("锁定成功");
    }

}


//    @PostMapping("/uploadMaterial")
//    public R uploadMaterial(@RequestParam MultipartFile file) throws IOException {
//        materialService.uploadMaterial(file);
//        return R.ok("锁定成功");
//    }

